"""

    异步操作Postgresql

"""

import asyncpg
import asyncio
from async_db.schema import *

async def main():
    connection = await asyncpg.connect(
        host="127.0.0.1",
        port="5432",
        database="products",
        user="around",
        password="zhouwei",
    )
    brand_query = "select * from brand"
    results = await connection.fetch(brand_query)
    for result in results:
        print(f"id: {result['brand_id']}, name: {result['brand_name']}")

    await connection.close()


asyncio.run(main())
